//app.js
App({
  aeHttp: function (args, resolve, reject) {
    wx.request({
      url: args.api,
      data: args.data,
      method: args.method,
      header: args.header,
      success: function (res) {
        if (res.data != null) {
          //接口实际返回的内容在res.data中
          resolve(res.data);
        } else {
          reject(res);
        }
      },
      fail: function (err) {
        reject(err);
      }
    })
  },
  onLaunch: function () {
    wx.getUserInfo({
      success: res => {
        this.globalData.userInfo = res.userInfo
        //console.log(res.userInfo)
        if (this.userInfoReadyCallback) {
          this.userInfoReadyCallback(res)
        }
      }
    })
    
  },
  getLocationInfo: function (cb) {
    var that = this;
    if (this.globalData.locationInfo) {
      cb(this.globalData.locationInfo)
    } else {
      wx.getLocation({
        type: 'gcj02', // 默认为 wgs84 返回 gps 坐标，gcj02 返回可用于 wx.openLocation 的坐标
        success: function (res) {
          that.globalData.locationInfo = res;
          cb(that.globalData.locationInfo)
        },
        fail: function () {
          // fail
        },
        complete: function () {
          // complete
        }
      })
    }
  },
  globalData: {
    userInfo: null,
    locationInfo:null,
    _json:null,
    _by:false,
    orderallprice:"0.00",
    all_price: "0.00",
    yhj: "0.00",
    kg: "0.00",
    yun_price: "0.00",
    yhjtext: "",
    _dzname:"",
    yhqArr:[],
    url:"https://csb2c.fenxiangqu.cn/"
  }
})